package com.jar.exercise.泛型.练习;

import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.*;

public class DAO<T> {
	private final Map<String, T> map = new HashMap<>();

	public void save(String id, T entity) {
		map.put(id, entity);
	}

	public T get(String id) {
		return map.get(id);
	}

	public void update(String id, T entity) {
		if (map.containsKey(id)) {
			map.put(id, entity);
		}
	}

	public Collection<T> list() {
		return map.values();
	}

	public void delete(String id) {

	}

}
